import request from '../utils/request'

/** 查询所有权限数据列表 */
export function fetchList(params) {
  return request({
    url: '/permission/v1/list',
    method: 'get',
    params: params
  })
}

/** 新增一条权限数据 */
export function createPermission(data) {
  return request({
    url: '/permission/v1/add',
    method: 'post',
    data: data
  })
}

/** 删除一条权限 */
export function deletePermissionr(id: number) {
  return request({
    url: `/permission/v1/delete/${id}`,
    method: 'delete'
  })
}

/** 更新一条权限 */
export function updatePermission(data) {
  return request({
    url: '/permission/v1/update',
    method: 'post',
    data: data
  })
}

//根据权限ID获取权限信息
export function getPermissionByUser(id: number) {
  return request({
    url: `/permission/v1/getOne/${id}`,
    method: 'get'
  })
}
